Q imagepicker Class
jQuery plugin that allows to choose and upload an image to the server by clicking / tapping on it. Works on various platforms (desktop and mobile etc) in similar way. On mobiles allows to choose picture from photo library or take an instant camera photo if OS supports such functionality. Should be applied to element like this $('#someimg').plugin('Q/imagepicker', options).
Constructor
Q imagepicker
-
[options]
Parameters:
-
[options]
Object optionaloptions is an Object that contains parameters for function
-
saveSizeName
ObjectRequired hash where key is the preferred image size and value is the image name. Several key-value pairs may be given and image will be generated and saved in different files. Key may be just one number, e.g. '100' which means square image 100x100 or in format '
x ', e.g. '80x120' to make non-square image. You can have one of or be empty, and then it will automatically keep the proportions. Or you can pass 'x' and then it will keep the original width and height of the image. -
[url]
String optionalurl is a url to post to.
-
[path="uploads"]
String optionalCan be a URL path or a function returning a URL path. It must exist on the server.
-
[subpath=""]
String | Function optionalA subpath which may be created on the server if it doesn't already exist. If this is a function, it is executed right before the request is sent.
-
[showSize=null]
String optionalshowSize is a key in saveSizeName to show on success.
-
[useAnySize=false]
String optionalwhether to tell the server to accept any size without complaining.
-
[crop]
Object optionalcrop If provided, the image will be cropped according to the given parameters before it is saved on the server in the saveSizeName formats. If the browser supports it, the cropping will occur in the browser.
-
[cropping=true]
Boolean optionalWhether to display an interface for selecting cropping images, before sending them to the server. If true, the cropping area overrides the crop option.
-
[preprocess]
Q.Event optionalpreprocess is a function which is triggering before image upload. Its "this" object will be a jQuery of the imagepicker element The first parameter is a callback, which should be called with an optional hash of overrides, which can include "data", "path", "subpath", "save", "url", "loader" and "crop"
-
[cameraCommands]
Array optionalcameraCommands the commands that pop up to take a photo
-
[onClick]
Q.Event optionalonClick is an event to execute during the click, which may cancel the click
-
[onSuccess]
Q.Event optionalonSuccess is Q.Event which is called on successful upload. First parameter will be the server response with an object in a format similar to the 'saveSizeName' field.
-
[onError]
Q.Event optionalonError Q.Event which is called if upload failed.
-
[onTooSmall]
Q.Event optionalonError Q.Event which is called if an image is selected that's too small for one of the sizes in saveSizeName. Return false to abort.
-
[onFinish]
Q.Event optionalonError Q.Event which is called at the end, whatever the outcome.
-
[onCropping]
Q.Event optionalHappens when the cropping dialog appears, in case you want to display hints or something.
-
Item Index
Methods
Methods
hautoscroll
-
[options]
Plugin for Animated moving Element content inside it from let to right
Parameters:
-
[options]
Object optionaloptions object containing parameters for function
-
[scrollTime]
Number optionalscrollTime number of interval for content right movement in milliseconds
-
[pauseBefore]
Number optionalpauseBefore is a number for interval before animation starts in milliseconds
-
[pauseAfter]
Number optionalpauseAfter number of interval for content left movement to margin-left: 0 in milliseconds
-
iScroll
-
[object_or_string]
Just a helper for iScroll plugin. Needed to simplify applying iScroll and Q/scrollIndicators plugins.
Parameters:
-
[object_or_string]
Mixed optional-
[Object]
Object optionalan Object, then it's a hash of options, similar to these passed to iScroll plus additional parameters: "indicators": Defaults to true. Whether to show scroll indicators (apply Q/scrollIndicators plugin).
-
[x]
Number optionalx -
[y]
Number optionaly -
[hScrollbar]
Boolean optionalhScrollbar -
[vScrollbar]
Boolean optionalvScrollbar -
[hScroll]
Boolean optionalhScroll -
[hideScrollbar]
Boolean optionalhideScrollbar -
[fadeScrollbar]
Boolean optionalfadeScrollbar -
[useTransition]
Boolean optionaluseTransition -
[topOffset]
Number optionaltopOffset -
[onRefresh]
Q.Event optionalonRefresh -
[onBeforeScrollStart]
Q.Event optionalonBeforeScrollStart -
[onScrollStart]
Q.Event optionalonScrollStart -
[onScrollMove]
Q.Event optionalonScrollMove -
[onScrollEnd]
Q.Event optionalonScrollEnd -
[onTouchEnd]
Q.Event optionalonTouchEnd -
[showArrows]
Boolean optionalshowArrows -
[horizontalGutter]
Number optionalhorizontalGutter -
[verticalGutter]
Number optionalverticalGutter -
[maintainPosition]
Boolean optionalmaintainPosition -
[autoReinitialize]
Boolean optionalautoReinitialize -
[animateScroll]
Boolean optionalanimateScroll -
[hijackInternalLinks]
Boolean optionalhijackInternalLinks -
[indicators]
Boolean optionalindicators
-
-
[String]
String optionalIf a string, then it's a command which may be: "remove": Destroys iScroll together with Q/scrollIndicators.
-
pick
()
Set the image in the imagepicker
remove
()
Removes the imagepicker functionality from the element